package org.springhbn.test;

import org.apache.log4j.Logger;
import org.hibernate.SessionFactory;
import org.hibernate.stat.Statistics;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springhbn.dao.ForumDao;
import org.springhbn.dao.ForumDaoInterface;
import org.springhbn.domain.Forum;

public final class Boot {

	  private static ApplicationContext applicationContext;
	  private static final String CONFIGPATH= "applicationContext.xml";
	  private static Logger logger = Logger.getLogger(Boot.class);

	  public static void main(final String[] args) throws Exception {
		  applicationContext = new ClassPathXmlApplicationContext(CONFIGPATH);
//		  SessionFactory sessionFactory = (SessionFactory) applicationContext.getBean("sessionFactory");
//		  Statistics statistics = sessionFactory.getStatistics();
//		  logger.debug(statistics.getConnectCount());
		  ForumDao forumDao = (ForumDao) applicationContext.getBean("forumDao");
		  logger.debug(forumDao.getForum(1));
//		  logger.debug(forumDao.findForumByName("houjinxin0"));
//		  logger.debug(forumDao.getForumNum());
	  }
}